{extend name="base" /}
{block name="body"}
<div class="layui-card">
  <div class="layui-card-body">
    <blockquote class="layui-elem-quote layui-text">
        优惠券：优惠券<span class="text-danger">补仓</span>在原有基础上<span class="text-danger">增加</span>所输入补充数量
    </blockquote>
    <div class="layui-form-item">
        <form class="layui-form layui-form-pane" action="{:request()->url()}" >
            <div class="layui-input-inline">
                <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="{if $Request.get.title}{$Request.get.title}{else}请输入关键字{/if}" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">{$Think.lang.search}</button>
                <button type="reset" class="layui-btn layui-btn-primary">{$Think.lang.reset}</button>
            </div>
        </form>
        <button class="layui-btn layui-btn-normal open-popup" data-title="{$Think.lang.add}" data-url="{:url('add')}"><i class="fa fa-plus"></i>{$Think.lang.add}</button>
    </div>
        <table class="layui-table layui-form" lay-skin="line">
            <thead>
                <tr>
                    <th>{$Think.lang.id}</th>
                    <th>{$Think.lang.name}</th>
                    <th>{$Think.lang.img}</th>
                    <th>{$Think.lang.source}</th>
                    <th>{$Think.lang.type}</th>
                    <th>{$Think.lang.cat}{$Think.lang.range}</th>
                    <th>{$Think.lang.good}{$Think.lang.range}</th>
                    <th>{$Think.lang.condition}</th>
                    <th>{$Think.lang.amount}</th>
                    <th>{$Think.lang.total}{$Think.lang.stock}</th>
                    <th>{$Think.lang.surplus}{$Think.lang.stock}</th>
                    <th>{$Think.lang.CreateTime}</th>
                    <th>{$Think.lang.Status}</th>
                    <th>{$Think.lang.Handle}</th>
                </tr>
            </thead>
            <tbody>
                {volist name="list" id="v" empty="$empty"}
                <tr>
                    <td>{$i}</td>
                    <td>{$v.name}</td>
                    <td><img src="{$v.img}" alt="{$v.name}"></td>
                    <td>{if $v.source eq 1}新人注册{elseif $v.source eq 2}签到赠送{elseif $v.source eq 3}购物赠送{elseif $v.source eq 2}邀请好友{else}其他{/if}</td>
                    <td>{if $v.type eq 1}现金{elseif $v.type eq 2}运费{elseif $v.type eq 3}积分{else}其他{/if}</td>
                    <td class="layui-badge-{if $v.cat_range}red{else}green{/if}">{if $v.cat_range}**分类{else}不限{/if}</td>
                    <td class="layui-badge-{if $v.good_range}red{else}green{/if}">{if $v.good_range}**商品{else}不限{/if}</td>
                    <td>{$v.condition}</td>
                    <td>{$v.price}</td>
                    <td>{$v.stock}</td>
                    <td class="layui-badge-{if $v.surplus lt 10}red{else}green{/if}">{$v.surplus}</td>
                    <td>{$v.create_time}</td>
                    <td><input type="checkbox" name="status" value="{$v.id}" lay-skin="switch" lay-filter="*" lay-text="开启|禁用" data-url="{:url('edit')}" {if $v.status eq 1}checked{/if}></td>
                    <td>
                    	<button class="layui-btn layui-btn-xs open-popup" data-title="{$Think.lang.edit}" data-url="{:url('edit', ['id' => $v.id])}"><i class="fa fa-edit"></i> {$Think.lang.edit}</button>
                        <button class="layui-btn layui-btn-warm layui-btn-xs open-popup" data-title="{$Think.lang.supply}" data-url="{:url('supply', ['id' => $v.id])}"><i class="fa fa-hdd-o"></i> {$Think.lang.supply}</button>
                        <button class="layui-btn layui-btn-danger ajax-del layui-btn-xs" data-title="{$Think.lang.drop}" data-url="{:url('del', ['id' => $v.id])}"><i class="fa fa-trash-o"></i> {$Think.lang.drop}</button>
                    </td>
                </tr>
                {/volist}
            </tbody>
        </table>
        <div class="page">{$list|raw}</div>
    </div>
</div>
{/block}
{block name="js"}
{/block}